﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblCENTERDAL : SqlDataProvider
	{

		#region[tblCENTER_GetbyAll]
		public DataTable tblCENTER_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCENTER_GetbyId]
		public DataTable tblCENTER_GetById(string CENTER_CODE)
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", CENTER_CODE));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCENTER_GetbyTop]
		public DataTable tblCENTER_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCENTER_Insert]
		public void tblCENTER_Insert(tblCENTERInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", Data.CENTER_CODE));
				cmd.Parameters.Add(new SqlParameter("@CENTER_NAME", Data.CENTER_NAME));
				cmd.Parameters.Add(new SqlParameter("@ADDRESS", Data.ADDRESS));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCENTER_Update]
		public void tblCENTER_Update(tblCENTERInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE", Data.CENTER_CODE));
				cmd.Parameters.Add(new SqlParameter("@CENTER_NAME", Data.CENTER_NAME));
				cmd.Parameters.Add(new SqlParameter("@ADDRESS", Data.ADDRESS));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCENTER_Delete]
		public void tblCENTER_Delete(string CENTER_CODE)
		{
			using (var cmd = new SqlCommand("sp_tblCENTER_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@CENTER_CODE",CENTER_CODE));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}